<?php

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of article
 *
 * @author Administrator
 */
class about extends CI_Controller {

    public function __construct() {
        parent::__construct();
        $this->url = $this->uri->segments;
    }

    public function index($id='') {
        $this->load->library('a_class');
        $class_obj = new a_class();
        $nav_one = $class_obj->get_child_class(CONFIG_ID);
        $class_id = $this->return_classid($nav_one);
        if($class_id){
            $chile_nav = $class_obj->get_child_class(CONFIG_ID,$class_id);
            if(!empty($chile_nav)){
                redirect($this->url[1].'/'.$chile_nav[0]['classlinkname']);
            }
        }
        
        //$this->load->view('article',$data);
    }

    private function return_classid($nav_one=array()){
        if(empty($nav_one)){
            return ;
        }else{
            foreach($nav_one as $k=>$v){
                if($v['classlinkname'] == $this->url[2]){
                    return $v['classid'];
                }else{
                    continue;
                }
            }
        }
    }

    public function detail($id) {
        if($id){
            $this->load->library('a_article');
            $article_obj = new a_article();
            $data['article_info'] = $article_obj->get_article($id);
            //print_r($data);
            $this->load->view('article_detail',$data);
        }else{
            redirect('cn/main/nofont');
        }
    }

}
